{% extends "base.volt" %}
        {% block pageHeader %}
        {{ stylesheet_link("/assets/manage/css/tabstyle.css", false) }}
        {{ stylesheet_link("/libs/bootstrap-daterangepicker/daterangepicker.css", false) }}
        {% endblock %}


        {% block pageFooter%}
        {{ javascript_include("/libs/bootstrap-daterangepicker/moment.min.js", false) }}
        {{ javascript_include("/libs/bootstrap-daterangepicker/daterangepicker.js", false) }}
        {{ javascript_include("/libs/layer-v1.9.3/layer.js", false) }}
        {{ javascript_include("/assets/manage/js/beautycanon/list.js", false) }}
        {% endblock %}



        {% block content %}
        {{ partial("module/left_beautycanon") }}
<div class="col-xs-10">
    <ol class="breadcrumb">
    	<li>美粒宝典</li>
        <li class="active">美粒宝典列表</li>
    </ol>

	<div class="commtable">
	<ul>
    	<li {% if state == 1 %} class="hover" {% endif %}><a href="{{ url.get('beautycanon/list',['state':1]) }}"> 已发布</a></li>
    	<li {% if state == 2 %} class="hover" {% endif %}><a href="{{ url.get('beautycanon/list',['state':2]) }}"> 待发布</a></li>
        <li {% if state == 3 %} class="hover" {% endif %}><a href="{{ url.get('beautycanon/list',['state':3]) }}"> 已删除</a></li>
    </ul>
	</div>
	<div style="clear:both;"></div>
    <div class="panel panel-default">
        <div class="panel-body">
            <form class="form-inline" role="form" action="" method="get" style="margin-right: 20px;">
           		<input type="hidden" name="state" value="{{state}}">
                <div class="form-group">
                    <div class="input-group">
                        <label class="input-group-addon" for="">标题:</label>
                        <input class="form-control" type="text" name="title" id="" value="<?=$title?>" />
                    </div>
                    <div class="input-group">
                        <label class="input-group-addon">城市</label>
                            <select class="form-control" name="filterCity" id="filterCity">
                                <option value="-10000" {{ filterCity == -10000 ? 'selected="selected"' : '' }}>全部</option>
                                <option value="0" {{ filterCity == 0 ? 'selected="selected"' : '' }}>全国</option>
                                {% for oc in openCity %}
                                    <option value="{{ oc.city_id }}" {{ filterCity == oc.city_id ? 'selected="selected"' : '' }} >{{ oc.city_name|e }}</option>
                                {% endfor %}
                            </select>
                    </div>

                </div>
                <div class="form-group">
                    <button type="submit" class="btn btn-primary"><i class="fa fa-filter"></i> 查 询</button>
                </div>
            </form>
        </div>
    </div>


    <table class="table table-hover">
        <thead>
        <tr>
            <th style="width: 60px;">ID</th>
            <th style="width: 150px;">封面</th>
            <th>标题</th>
            <th>城市</th>
            <?php if($state == 1){?>
            <th>浏览量</th>
            <th>点赞数</th>
            <?php }?>
            <th>状态</th>
            <th>添加时间</th>
            <th style="width: 180px">操作</th>
        </tr>
        </thead>
		<?php foreach($list as $r){?>
        <tr>
            <td><?=$r['id']?></td>
            <td><img style="width:90px;height:90px;" src="<?=$r['img_url']?>"/></td>
            <td><?=$r['title']?></td>
            <?php if($r['city_id'] == 0){?>
            	<td>全国</td>
            <?php }else{?>
            	<td><?=$r['city_name']?></td>
            <?php }?>
            <?php if($state == 1){?>
            
            <?php if(empty($r['fit'])){?>
            	<td>0</td>
            <?php }else{?> 
            	<td><?=$r['fit']?></td>
            <?php } ?> 
            <?php if(empty($r['assist'])){?>
            	<td>0</td>
            <?php }else{?> 
            	<td><?=$r['assist']?></td>
            <?php } ?> 
            <?php }?>
            <td>
            	<?php if($r['state']==1){?>
                <span>已发布</span>
                <?php }else if($r['state']==2){?>
                <span>待发布</span>
                <?php }else if($r['state']==3){?>
                <span>已删除</span>
                <?php }?>
            </td>         	           
            <td><?=$r['settime']?></td>
            
            <td>
                <div class="dropdown">
                    <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"><i class="fa fa-cogs"></i> 操作 <span class="caret"></span>
                    </button>
                    <ul class="dropdown-menu" aria-labelledby="dropdownMenu">
                        <li><a href="/frontend/share/beautyCanon?id=<?=$r['id']?>" target="_blank"><i class="fa fa-eye fa-fw"></i> 预览</a></li>
                        <li><a href="{{url.get('beautycanon/edit')}}?id=<?=$r['id']?>"><i class="fa fa-pencil fa-fw"></i> 编辑</a></li>


                        <?php if($r['state']==1){?>
                        <li> <a class="btn_delete" durl="{{url.get('beautycanon/setState')}}" did="<?=$r['id']?>" dstate="3" href="javascript:;"><i class="fa fa-trash-o fa-fw"></i>删除</a></li>
                        <?php }else if($r['state']==2){?>
                        <li> <a class="btn_delete" durl="{{url.get('beautycanon/setState')}}" did="<?=$r['id']?>" dstate="3" href="javascript:;"><i class="fa fa-trash-o fa-fw"></i>删除</a></li>
                        <li><a class="btn_delete" durl="{{url.get('beautycanon/setState')}}" did="<?=$r['id']?>" dstate="1" href="javascript:;"><i class="fa fa-reply fa-fw"></i>发布</a></li>
                        <?php }?>
                    </ul>
                </div>
                
            </td>
        </tr>
		<?php }?>
    </table>
{{ this.tagNav.page(
        page,
        total,
        limit,
        url.get('beautycanon/list', [
            'title': title,
            'filterCity': filterCity,
            'state': state,
            'page': '__PAGE__'
        ]
    )) }}
</div>


        {% endblock %}
